package com.example.x5webviewdemo.activity;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.x5webviewdemo.R;

/**
 * @作者: njb
 * @时间: 2019/12/4 13:11
 * @描述:
 */
public class CustomWebViewActivity extends AppCompatActivity {
    private WebView webView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scroll_webview);
        initWebView();
    }

    private void initWebView() {
        webView = findViewById(R.id.webView);
        WebSettings webSettings = webView.getSettings();
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
        webView.loadDataWithBaseURL(null, getString(R.string.content), "text/html", "utf-8", null);
    }
}
